home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
EDITOR
/
FUGUE_3.ARJ
/
WF.C
< prev
next >
Wrap
Text File
|
1990-11-05
|
35KB
|
734 lines
.f3 - # - Appendix C - Examples & Tips
.rm70
.mt5
.mb5
.pl66
.tc
.tc C. EXAMPLES & TIPS ....................................#
APPENDIX C EXAMPLES & TIPS
This appendix consists of examples of various Word Fugue features.
They are in addition to the examples distributed throughout the
manual, and in the tutorial. The examples are intended to give you
ideas for using Word Fugue in your own work or to help you with a
particular application. Because Word Fugue users often have questions
relating to merge printing, many of these examples are related to
merge printing applications.
.tc Changing Page Length and Line Height ...............#
Changing Page Length and Line Height
Suppose you are printing a document for readers with visual
impairment. You plan to use double width characters on paper that is
14 inches long. You also plan to increase the line height in order to
increase the separation between lines.
By default, Word Fugue assumes that you are using American standard
8½-by-11-inch paper with 6 lines of text to the inch. This example
shows you how to set up a document for paper 14 lines long, with 4
lines per inch.
First, you must tell Word fugue of the new page length. At the default
of 6 lines per inch, 14 inch paper is 6 * 14 = 84 lines. So in order
to tell Word Fugue that you are using 14 inch paper, use the .PL
command to set the page length to 84.
.PL 84
Now, use the .LH command to set the appropriate line height, and Word
Fugue will calculate the correct number of lines per page at this
height. You must have set the page length first, or Word Fugue will
assume that you are using 66 line paper. The default line step is
measured in 1/48ths of an inch - if your printer does not use this,
then you must determine the appropriate step and number. At 4 lines
per inch, you need 12/48ths of an inch per line:
.LH 12
.LH 18/72 if your printer uses 1/72nds of an inch
.LH 54/216 if your printer uses 1/216ths of an inch
Word Fugue will calculate the new number of lines that will fit on a
page - 84/12*8 = 56 lines. (Or 14*4 = 56!). Subtract of the margins
from the new page length to determine how many lines in the text body:
56-5-4=47. Thus there will be 47 text lines to the page. (Please note
that this is not a figure for the .PL command.)
If you are using double width characters, you should change the right
margin to 33 to fit on the line (.RM33) and you should change the page
ofset to 5 (.PO5) since these are measured in characters.
.CP6
.tc Selective Printing of Page Numbers .................#
Selective Printing of Page Numbers
If you are printing a manual such as this, you probably do not want
page numbers on the title page, you want to use lower case roman
numerals for the table of contents, and ordinary numbers starting from
one at the first page of the first chapter. The following example
shows you how to do this.
┌─────────────────────────────────────────────────────────────────┐
│ .po10 │
│ .rm70 │
│ .mt5 │
│ .mb4 │
│ .pl66 │
│ │
│ Word Fugue │
│ │
│ User's Guide │
│ │
│ .pa │
│ --------------------- (page break) --------------- │
│ .H1 WORD FUGUE USERS GUIDE │
│ .H2 TABLE OF CONTENTS │
│ .h3 ────────────────────────────────────────────── │
│ .PA │
│ .f1 │
│ .f2 ────────────────────────────────────────────── │
│ .f3 - # - │
│ A ─────────.pn1 │
│ B ─────────.pt r │
│ C ─────────.fiwf.toc contains the text for table of contents │
│ .pa │
│ --------------------- (page break) --------------- │
│ .H1 WORD FUGUE USERS GUIDE │
│ .h2 ────────────────────────────────────────────── │
│ D ─────────.H3 │
│ E ─────────.pn1 │
│ F ─────────.pt n │
│ │
│ [Text] │
│ │
└─────────────────────────────────────────────────────────────────┘
For the sample book above, printing starts without page numbers on the
title page. (This is the default, so the .OP command is not needed).
The .PA command starts a new page for the table of contents. The
footing with the # will cause page numbers to be printed from then on.
However, the first page of the table of contents is physically the
second page of the document, and Word Fugue will have set the page
number to 2. Thus the line labeled A (.PN1) resets the page number to
1 for the table of contents.
We want lowercase roman Numerals for the contents, so line B (.PT r)
will set page numbers to be printed in lower case roman numerals. The
table of contents is held in a separate file WF.TOC and so is copied
in using the .FI file include command at line C.
At the end of the table of contents we take a new page and change the
heading. Line D blanks heading line 3. Line E resets the page number
back to 1 again for the first chapter. Line F changes the page number
type back to ordinary numbers.
.tc Printing the First Page on Letterhead ..............#
Printing the First Page of a Document on Letterhead
This is the format for the first page of an organization's formal
correspondence on preprinted letterhead.
┌────────────────────────────────────────────────────────────┐
│ │
│ ..STATIONARY FORMAT │
│ ..FIRST PAGE │
│ .RRL ! ! ! ! R │
│ .MT10 │
│ .MB5 │
│ .PO14 │
│ {.@D8} │
└────────────────────────────────────────────────────────────┘
The large top margin of 10 accomodates the preprinted letterhead. The
{.@D8} causes the current date to be printed in the format dd month yyyy.
The letter should should be printed with Manual Paper Feed turned on
to cause the print to pause between pages so you can swap paper for
the following pages (unless you have a special printer that supports
several bins of single sheets - in which case you need to define a
print command to switch bins). The example below shows how to print
the rest of the letter.
┌────────────────────────────────────────────────────────────┐
│ │
│ ..FOLLOWING PAGES │
│ .MT5 │
│ .MB4 │
│ .PG │
│ .PC 1 │
│ │
└────────────────────────────────────────────────────────────┘
The .PG command turns on printing of page numbers in the default
column at the foot of the page. The .PC 1 places the page number in
column 1.
TIP You could set up this format (or your own variation) as a
separate document, and whenever you want to print such a letter,
use the file read command (Ctrl K R) to insert the document into
the letter.
.cp10
.tc Printing a Standard Business Envelope ..............#
Printing a Standard Business Envelope
Assuming your printer can handle envelopes, then to print one you need
only consider it as a document with a short page length and special
margins.
The format shown below is suitable for a standard 9½-by-4-inch
business envelope, printing 10 characters per inch.
┌───────────────────────────────────────────────────────────┐
│ │
│ .PA {begin envelope on new page} │
│ .PL24 {standard size @ 6 lines per inch} │
│ .MT12 {start printing 12 lines from top} │
│ .MB0 {eliminate bottom margin} │
│ .PO40 {begin printing 40 spaces from left edge} │
│ │
└───────────────────────────────────────────────────────────┘
If you use different size envelopes, change the dot commands
accordingly.
TIP You could set up this format (or your own variation) as a
separate document, and whenever you want to print an envelope,
use the file read command (Ctrl K R) to insert the format into
the document.
.tc A Typical Master Document for Merge Printing .......#
A Typical Master Document for Merge Printing
The following is a sample master document for a form letter that
includes variable names and merge print dot commands:
┌──────────────────────────────────────────────────────────┐
│ .df names.dat │
│ .rv name,greeting,address1,address2 │
│ ..make sure that there is enough room for letterhead │
│ .mt 20 │
│ │
│ {.D8} │
│ │
│ &name& │
│ &address1& │
│ &address2& │
│ │
│ Dear &greeting&, │
│ │
│ thank you for your recent enquiry. ........ │
│ │
│ yours sincerely │
│ │
│ fred Nurk │
│ .pa │
└──────────────────────────────────────────────────────────┘
The four variables in the form letter are surrounded by ampersands (&).
The date in NAMES.DAT might look like this:
┌───────────────────────────────────────────────────────────┐
│ Joe Bloggs,Mr. Bloggs,43 Oak drive,Acorn city SA 5871 │
│ Jane Smith,Ms Smith,7 Main St,The Village TAS 7766 │
│ Cecil Cedric,Cecil,9 Rose ave, Melbourne VIC 3021 │
└───────────────────────────────────────────────────────────┘
.tc Merge Printing Envelopes for a Mass Mailing ........#
Merge Printing Envelopes for a Mass Mailing
You can use the same data file from the letters to print the
envelopes. However, you will need to create a different master
document. Below is an example of such a document:
┌──────────────────────────────────────────────────────────────┐
│.df names.dat │
│.rv name,greeting,address1,address2 │
│.av "Put an envelope in the printer. Press enter when ready",X│
│.pl24 │
│.mt12 │
│.mb0 │
│.po40 │
│&name& │
│&address1& │
│&address2& │
│.pa │
└──────────────────────────────────────────────────────────────┘
The dot commands select the data file, read the data, and interrupt
printing so you can put in a new envelope. They also set up the format
for a standard envelope as above.
The .AV tells word Fugue to puase during the merge printing and
display the message in quotes. The X variable in the .AV command is
used only because the .AV command requires a variable for the keyboard
input. Using the .AV is realy only a trick to display a message and
pause until you press Enter.
The next 4 dot commands set up the format for the envelope - the page
length, top and bottom margins, and offset.
The address variables print the name and address from the data file.
The .PA starts a new envelope.
.cp40
.tc Merge Printing Sticky Labels Three Across ..........#
Merge Printing Sticky Labels Three Across
This example shows you how to set up a format for merge printing names
and addresses on stick labels. The dot commands here assume standard
3½-inch by 1½-inch labels, printed at 10 characters per inch and 6
lines per inch. Each label can therefore fit 35 characters.
┌──────────────────────────────────────────────────────────────┐
│ .po 2 │
│ .PL 9 │
│ .mt 1 │
│ .mb 1 │
│ .df label.dat │
│ .rv name1,address1,city1,state1,pc1 │
│ .rv name2,address2,city2,state2,pc2 │
│ .rv name3,address3,city3,state3,pc3 │
│ .sv name1/L30=&name1& │
│ .sv name2/L30=&name2& │
│ .sv name3/L30=&name3& │
│ .sv address1/L30=&address1& │
│ .sv address2/L30=&address2& │
│ .sv address3/L30=&address3& │
│ .sv cityline1/L30=&city1&, &state1&, &pc1& │
│ .sv cityline2/L30=&city2&, &state2&, &pc2& │
│ .sv cityline3/L30=&city3&, &state3&, &pc3& │
│ &name1& &name2& &name3& │
│ &address1& &address2& &address3& │
│ &cityline1& &cityline2& &cityline3& │
│ .pa │
└──────────────────────────────────────────────────────────────┘
Each row of labels is treated as a page, so the page length is set to
9 lines (6 lines per inch => 1½" = 9 lines). The date for each label
is read in, and then formatted.
The .SV lines format each variable to a length of 30 characters, left
justified. We could have defined formats for the variables City, State
and PC, so that their combined length totaled 30 characters, but the
method shown here of creating another variable is easier to work with.
There are 4 spaces between each variable reference in the print
section. During merge printing, each variable is replaced with a
field 30 characters wide. The five spaces between them add up to a
combined width of 35 characters, which is the label width. The point
of the .PO2 command is to ensure that the text does not start right on
the edge of the label (which would look unsightly).
The .PL9 command also tells the printer the page length, so it does
not matter whether you have form feeds on or not. However, if your
printer does not have a control sequence for setting page length, you
should turn off form feeds before printing (otherwise the printer will
spit out 66 lines for each label!).
Missing Data in Some Records
.tc Missing Data in Some Records ....................#
It may well be that in a row of labels, some may be missing the first
line of the address. This is still a valid address, but can look
unsightly. This is easily fixed by use of conditional dot commands.
This example assumes that the mailing list consists of name, street
address and city line, and that the street address is missing.
After Word Fugue has read all variables from the data file for a row
of labels, it can check to see if any street addresses are missing.
The method we will use is to place the name into the street line, and
blank out the name:
┌────────────────────────────────────────────────────┐
│ .IF &ADDRESS1&= │
│ .SV ADDRESS1=&NAME1& │
│ .SV NAME1/L30= │
│ .EI │
│ .IF &ADDRESS2&= │
│ .SV ADDRESS2=&NAME2& │
│ .SV NAME2/L30= │
│ .EI │
│ .IF &ADDRESS3&= │
│ .SV ADDRESS3=&NAME3& │
│ .SV NAME3/L30= │
│ .EI │
└────────────────────────────────────────────────────┘
You can modify this basic procedure to cater for other situations
where data could be missing.
.tc Merging and Centering a Variable in a Page .........#
Merging and Centering a Variable in a Page
To centre a variable in a document page, simply use the .SV command,
and specify the format as /C for centred, with the width the same as
the ruler line.
.RV name
.SV name/C70=&name&
will define name as 70 characters wide (the same as the ruler line),
and centre the value read. Simply place the variable at the left
margin of your document, and the text will be centred on the page.
.tc Maths, Formatting and Conditionals in Merging ......#
Maths, Formatting and Conditionals in Merging
The example on the next page shows how to set up a more complicated
document, which is only printed if the customer spent a total of more
than $40 during the last month, on at least 4 different items. A
special discount is offered, 5% for those who spent less than $400,
and 10% for those who spent more.
.pa
.df names.dat
.rv first,last,street,city,state,postcode
.rv item1,price1,item2,price2,item3,price3,item4,price4
A .ma total$=&price1&+&price2&+&price3&+&price4&
B .sv total/R10=&total&
C ────┬ .sv item1/L25=&item1&
│ .sv item2/L25=&item2&
│ .sv item3/L25=&item3&
└ .sv item4/L25=&item4&
D ────┬ .sv price1/R17=&price1&
│ .sv price2/R17=&price2&
│ .sv price3/R17=&price3&
└ .sv price4/R17=&price4&
E ┌─── .if &total& >= 40.00
F ─│──────────────────── {.@D8}
│ Nurk's Special Supplies
│ Erehwon
│
│ &First& &Last&
G ─│─┌─ .if &street&
│ │ &street&
│ └─ .ei
│ &city& &state& &pastcode&
│
│ Dear &First&
│
│ Our records show that you have bought four or more items from
│ us in the last month.......
│ ... we are offering you the following discount on your next
│ purchase:
│
H ─│─┌─ .if &total& < 400.00
│ │ five percent
│ ├ .el
│ │ ten percent
│ └─ .ei
│
I ─│─┌─ .if &item2&
│ │ Here list a list of your last purchases
│ ├ .el
│ │ Here is your last purchase
│ └─ .ei
│
J ─│──┬ &item1&&price1&
│ │ &item2&&price2&
│ │ &item3&&price3&
│ └ &item4&&price4&
│
│ Total &total&
│
│ sincerely
│
│ Fred Nurk
│ .pa
└─── .ei
Explanation
At A, the total is calculated from the four prices read in, and is
formated as 2 decimal places (the $ at the end of total does this).
Line B formats the total to be 10 characters wide, right justified.
Lines C format the item descriptions to be 25 characters wide, left
justified.
Lines D format the prices to be 17 characters wide, right justified.
Line E checks that the total expenditure is greater than or equal to
40. If it is less, the entire letter is skipped down to the matching
.EI, which means that nothing prints.
Line F inserts todays date in the format dd month yyyy.
Lines marked G test if the variable street contains a value, and
prints it if it does. If the variable is blank, the line is omitted.
The lines labeled H print the words five percent if the total is
less than 400, and print the words ten percent otherwise.
The lines marked with I test if there is a second item, and print
the words here is a list of your last purchases if there is a second
item, but print the words Here is your last purchase if there is
not a second item.
The lines J porint a list of items, they have already been
formatted, so there is no need for spaces between the variable
names, the formatting takes care of that. The first ampersand (&) of
the total is in the column so that it will line up with the other
prices when they print.
NOTE if you need to omit variables from your datafile, place a blank
and follow it by a comma (,). Each .RV command only reads
variables from one line of the file
.tc Advanced Mathematics in Merge Printing .............#
Advanced Mathematics in Merge Printing
All of the functions of Word Fugue's pop up calculator are available
for the .MA command. You can do complicated trigometric functions and
so on. For example to calculate loan payments from the amount
borrowed, interest rate and term of loan is:
P = A * i * (i + 1)n/((i+1)n-1)
where P is the amount of each payment
A is the amount borrowed
i is the interest rate per payment interval. If the payment
interval is monthly, divide i by 12. i must be converted from
a percentage to a decimal fraction - 12% = 0.12, and on
monthly payments = 0.01
n is the total number of payments. For example monthly payments
over 4 years total 48 payments
This equation can be expressed in a .MA commands below. The actual
equation is on one line only - since Word Fugue's maximum line length
is 999 characters, you should be able to express the most complicated
equation on one line. If you cannot, break it up into parts, calculate
intermediate values, and then combine the intermediate values.
┌────────────────────────────────────────────┐
│ .. calculate monthly interest as decimal │
│ .MA i=&interest&/1200 │
│ .. calculate payment P │
│ .MA P$=&A&*&i&*(&i&+1)^&n&/((&i&+1)^&n&-1) │
└────────────────────────────────────────────┘
The hat sign (^) is used for raising the first number to the power of
the second, thus 2 squared (22) is 2^2, and 2 cubed (23) is 2^3. The
variable interest is read in as a percentage and then divided by 1200
to convert it to a decimal rate per month. It is more efficient to
calculate i once and refer to it in the second equation than to
calculate it each time it is referenced (3 times), and probably less
confusing too. The payment figure is truncated to 2 decimal places for
printing as a Dollar amount. Without this, Word Fugue might print the
payment figure as a 14 digit decimal number, depending on just how
many decimal places the exponentiation (raising to the nth power)
produced.
.tc Creating a Lookup Table for Merge Printing .........#
Creating a Lookup Table for Merge Printing
There can be times when, for example, you want to print different
messages for different categories of people. Either you do not want to
type the same message in over and over again, or you want to use a
standard mailing list several times for several different sets of
messages.
You could read in the customer type, and use conditionals (.IF .EL
.EI) to determine the message to be printed, but there is another
method, using what is known as recurrsion:
In your sample data file there are 3 records:
┌───────────────────────────────────┐
│Fred Nurk,&prize1& │
│Susan Soo,&prize2& │
│Sally Zed,&Prize2& │
└───────────────────────────────────┘
.CP16
The form letter looks like this:
┌──────────────────────────────────────────────┐
│.sv prize1=A new car │
│.sv prize2=A trip to New Zealand for 2 │
│.df data.dat │
│.rv name,prize │
│Dear &name& │
│ │
│Your prize is &prize& │
│ │
│sincerely yours │
│prize coordinator │
│.pa │
│ │
└──────────────────────────────────────────────┘
When the variable prize is read from the data file, it will contain
either "&prize1&" or "&prize2&". When it is printed, it will be
replaced with the characters it contains, and since they have been
defined as variables themselves, they in turn will be replaced with "A
new car" and "A trip to New Zealand for 2" respectively.
.tc Proof Reading Your Printouts Before Merge Printing .#
Proof Reading Your Printouts Before Merge Printing
Keep in mind that when merging documents with data files, everything
has to be correct. Take your time to spell check your documents, proof
read them carefully. In addition, you should try out the different
combinations (especially if you are using conditionals) by using a
sample data file before the real thing.
You can either run this to paper, or print it to disk and review the
output using Word Fugue. If your document is large, you could make an
exact copy of it, and working on the copy, delete most of the text,
leaving just enough to identify the various conditions and so on. Run
this with your sample data file to see how things work.
This approach is ideal for developing a merge print document - work
out the commands you need to use, and test them with a sample data
file, then when you have fixed any errors in the commands, flesh out
the document with the real text, and print it again with the sample
data file. Be sure to try each of the different combination so that
you know you won't have funny merged documents in some situations.
Only when you are sure that everything is right should you run the
real print.
.cp15
.tc Working with Books and Chapters ....................#
Working with Books and Chapters
For convenience, you should break a long document such as a book or a
research paper down into sections or chapters. Each chapter should be
set up as a separate file. To simplify printing, generation of table
of contents and indexes, you should create a Master Document that
includes each chapter using a .FI command. With the master document
loaded into Word Fugue, you can easily open a chapter by placing the
cursor on the appropriate .FI line and pressing Ctrl F to load the
chapter into a separate window.
If you inspect the compressed document file that came with your copy
of Word Fugue, you will find that it contains an earlier version of
the manual you are reading. The master document is WF.DOC, and all the
chapters are WF.nnn, where nnn is a number. The table of contents is
WF.TOC. The table of contents is generated by specifying WF.DOC as the
file to process, and each chapter is included as needed by the .FI
command.
Below is a section of the master document:
┌──────────────────────────────────────────────────────┐
A ─────┬─│.po O 12 │
└─│.po E 8 │
│ │
│ Word Fugue │
│ │
│ User's Guide │
│ │
│.pa │
B ─────┬─│.f1 │
├─│.f2 ──────────────────────────────────────────────────│
└─│.f3 - # - │
C ─────┬─│.pn1 │
└─│.pt r │
D ───────│.fiwf.toc │
┌─│.pa │
E ─────┼─│.H1 WORD FUGUE USERS GUIDE │
├─│.h2 ──────────────────────────────────────────────────│
└─│.H3 │
F ─────┬─│.pn1 │
└─│.pt n │
G ─────┬─│.fiwf.001 │
H ──┬──│─│.pbo │
│ ├─│.fiwf.002 │
├──│─│.pbo │
│ ├─│.fiwf.003 │
├──│─│.pbo │
│ └─│.fiwf.004 │
├────│.pbo │
└──────────────────────────────────────────────────────┘
.cp7
A - The page offset for even numbered pages is set to 8 characters,
while that for odd numbered pages is set to 12 characters. This is
to allow for the binding, since the book will eventually be
printed double sided, with the left hand pages bearing even
numbers, and the right hand pages bearing odd numbers.
B A three line footer is created, with the page number as the lowest
line.
C The page number is reset to 1 via the .PN 1 line, while the type
of the page number is set to lower case roman numerals via the
.PTr command.
D The table of contents is included.
E A new page is started, and a heading is set up for the entire
document.
F The page number is reset to 1, and the number type is changed to
ordinary numbers via the .PT n command. Failure to reset the page
number to 1 will result in the first page being numbered 4 or 5 as
it follows the table of contents.
G These lines include the first 4 chapters of the manual.
H These lines ensure that each new chapter starts on an ODD numbered
page. If the next page is even numbered, a blank page will be
printed to force the text onto an odd numbered page.
There are many more commands in the real master document, and it is
suggested that you inspect the sample documents to see how everything
is done.
Headings in your Table of Contents
Since the table of contents is generated each time, and headings etc
need to be placed into the table of contents when it is generated.
This can be accomplished by prefixing the dot commands by .TC, since
the text that follows the dot command is copied literally into the
table of contents file.
For example, the following commands in a document:
┌───────────────────────────────────────┐
│.TC.HE TABLE OF CONTENTS │
│.TC.FO - # - │
│.TC.PT r │
│.TC CHAPTER 1 ...................# │
│.tc sub heading 1 ............# │
│.tc sub heading 2 ............# │
│.tc │
│.tc CHAPTER 2 ...................# │
└───────────────────────────────────────┘
.cp17
will produce a table of contents file (.TOC) containing:
┌───────────────────────────────────────┐
│.HE TABLE OF CONTENTS │
│.FO - # - │
│.PT r │
│ CHAPTER 1 ...................1 │
│ sub heading 1 ............1 │
│ sub heading 2 ............2 │
│ │
│ CHAPTER 2 ...................4 │
└───────────────────────────────────────┘
A blank line can be produced by typing a .TC command with no text
following.